var maxVowels = function (s, k) {
  const vowels = new Set(["a", "e", "i", "o", "u"]);
  let count = 0,
    l = 0,
    r = 0;
  while (r < k) {
    //初始化大小k的窗口
    vowels.has(s[r]) && count++;
    r++;
  }
  let max = count;
  while (r < s.length) {
    //不断移动窗口
    vowels.has(s[r]) && count++;
    vowels.has(s[l]) && count--;
    l++;
    r++;
    max = Math.max(max, count); //更新最大元音数
  }
  return max;
};
